#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<string.h>
#include<unistd.h>
int main()
{
    printf("stdin:%d\n",stdin->_fileno);
    printf("stdout:%d\n",stdout->_fileno);
    printf("stderr:%d\n",stderr->_fileno);
    FILE* fp = fopen("log1.txt","w");
    printf("fp1 = %d\n",fp->_fileno);
    //umask(0);
    //int fd1 = open("text1.txt",O_WRONLY | O_CREAT | O_APPEND,0666);
    //const char* massage = "helloworld\n";
    //write(1,massage,strlen(massage));
    //int fd2 = open("text2.txt",O_WRONLY | O_CREAT | O_APPEND,0666);
    //int fd3 = open("text3.txt",O_WRONLY | O_CREAT | O_APPEND,0666);
    //int fd4 = open("text4.txt",O_WRONLY | O_CREAT | O_APPEND,0666);
    //int fd5 = open("text5.txt",O_WRONLY | O_CREAT | O_APPEND,0666);
    //printf("fd:%d",fd1);
    //printf("fd:%d",fd2);
    //printf("fd:%d",fd3);
    //printf("fd:%d",fd4);
    //printf("fd:%d",fd5);
    //const char* massage = "helloworld\n";
    //int count = 10;
    //while(count--){
    //write(fd, massage, strlen(massage));//fd: 后面讲， msg：缓冲区首地址， len: 本次读取，期望写入多少个字节的数
                     //据。 返回值：实际写了多少字节数据
    //}
    //close(fd);
    //const char *massage = "hehehhehe\n";
   //FILE* fd = fopen("log.txt","a");
   //int count = 10;
   //while(count--)
   // fwrite(massage,strlen(massage),1,fd);
   // fclose(fd);
   // return 0;
}
